package com.sikaryofficial.workbench.controller;

import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.workbench.domain.dto.resp.notify.UserNotice;
import com.sikaryofficial.workbench.manager.NoticeManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/notice")
@Api(tags = "渠道商-通知公告")
@Slf4j
public class NoticeController {

    @Autowired
    private NoticeManager noticeManager;

    /**
     * 通知公告列表
     * @return
     */
    @GetMapping("/listNotice")
    @ApiOperation("通知公告列表")
    public R<List<UserNotice>> listNotice(@ApiParam(value = "通知公告ID，不为空则查询该公告之前的公告数据") Long noticeId,
                                          @ApiParam(value = "每页大小，默认为10") @RequestParam(defaultValue = "10") Integer size) {
        return R.ok(noticeManager.listNotice(noticeId, size));
    }
}
